{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "## Получение угла и оси вращения из матрицы поворота\n"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### Импорты"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "from robobase.converters import rotateMatrixToAxisAndAngle"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### Создание"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.0 [None None None] None\n",
      "3.141592653589793 [0. 1. 0.] [-0. -1. -0.]\n",
      "2.28517747450237 [0.29688994 0.78385297 0.54546743] None\n"
     ]
    }
   ],
   "source": [
    "R0 = np.array([[1, 0, 0],\n",
    "              [0, 1, 0],\n",
    "              [0, 0, 1]])\n",
    "\n",
    "R1 = np.array([[-1, 0, 0],\n",
    "              [0, 1, 0],\n",
    "              [0, 0, -1]])\n",
    "\n",
    "R2 = np.array([[-0.5092, -0.0269, 0.8602],\n",
    "              [0.7973, 0.3617, 0.4833],\n",
    "              [-0.3242, 0.9319, -0.1628]])\n",
    "\n",
    "angle0, w01, w02 = rotateMatrixToAxisAndAngle(R0)\n",
    "angle1, w11, w12 = rotateMatrixToAxisAndAngle(R1)\n",
    "angle2, w21, w22 = rotateMatrixToAxisAndAngle(R2)\n",
    "print(angle0, w01, w02)\n",
    "print(angle1, w11, w12)\n",
    "print(angle2, w21, w22)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}